package cn.wolfcode.trip.base.mapper;


import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    int insert(User record);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKey(User record);

    User selectByEmail(String email);

    User selectByInfo(@Param("email") String email,
                      @Param("password") String password);

    List<User> selectForList(QueryObject qo);
    //通过用户名获得用户的id,atme要用到
    Long getIdByUserName(String UserName);

    Map<String, Object> getCurrentIdByTargetId(@Param("currentId") Long currentId,
                                               @Param("targetId") Long targetId);

    void insertFollow(@Param("currentId") Long currentId,
                      @Param("targetId") Long targetId);

    void deleteRelation(@Param("currentId") Long currentId,
                        @Param("targetId") Long targetId);

    void updateFansNum(@Param("targetId") Long targetId);

    void updateFollowNum(@Param("currentId") Long currentId);

    void removeFansNum(@Param("targetId") Long targetId);

    void removeFollowNum(@Param("currentId") Long currentId);

    Integer getUserScoreById(@Param("userId") Long userId);

    void updateUserScore(@Param("userId") Long userId, @Param("score") int score);
}